// 本地持久化 token
// 消除   魔法字符串
const TOKEN_KEY = 'itcast_geek_h5'

export function getToken() {
  return JSON.parse(localStorage.getItem(TOKEN_KEY))
}

export function setToken(token) {
  localStorage.setItem(TOKEN_KEY, JSON.stringify(token))
}

export function removeToken() {
  localStorage.removeItem(TOKEN_KEY)
}

export function hasToken() {
  return !!getToken().token //有token
}
